package itbour.onetouchshow.adapter;

import android.content.Context;
import android.graphics.Color;
import android.text.TextUtils;

import itbour.onetouchshow.R;
import itbour.onetouchshow.adapter.base.BaseAdapterHelper;
import itbour.onetouchshow.adapter.base.normal.QuickAdapter;
import itbour.onetouchshow.bean.VideoSizeConfigBean;

/**
 * Created by guoh on 2018/7/6.
 * 功能描述：
 * 需要的参数：
 */
public class VideoSizeAdapter extends QuickAdapter<VideoSizeConfigBean> {
    public VideoSizeAdapter(Context context) {
        super(context, R.layout.item_video_size);
    }

    @Override
    protected void convert(BaseAdapterHelper helper, VideoSizeConfigBean item, int position) {
        if (item.getColor() != 0) {
            helper.setBackgroundRes(R.id.ll_layout, item.getColor());
        }
        if (item.getResId() != 0) {
            helper.setBackgroundRes(R.id.iv_res, item.getResId());
        }
        helper.setVisible(R.id.iv_res, item.getResId() != 0);
        helper.setText(R.id.tv_size, item.getSize());
        helper.setVisible(R.id.tv_size, !TextUtils.isEmpty(item.getSize()));
        helper.setText(R.id.tv_introduce, item.getIntroduce());
        helper.setTextColor(R.id.tv_introduce, (position == data.size() - 1) ? Color.parseColor("#666666") : Color.WHITE);
    }
}
